package com.study.design.pattern.pattern.behavioral.observer.spring;

import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;

/**
 * @Author: gongsl
 * @Date: 2025-03-23 23:51
 * @description: 监听器-天气记者
 */
@Component
public class WeatherReporter {
    @EventListener
    public void handleWeatherChangeEvent(WeatherChangeEvent event) {
        System.out.println("WeatherReporter: 天气变化通知 -> 旧温度: " + event.getOldTemperature()
                + "°C, 新温度: " + event.getNewTemperature() + "°C");
    }
}
